Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: update to Eslint 3.19.0 and replace custom rule #12162

Closed
wants to merge 2 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Apr 2, 2017

Commit 1: Update ESLint to 3.19.0.

Commit 2: ESLint 3.19.0 allows the specification of selectors that represent disallowed syntax. Replace our custom rule for timer arguments with a pair of no-restricted-syntax option objects.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

tools

Trott added 2 commits April 1, 2017 23:12
ESLint 3.19.0 allows the specification of selectors that represent
disallowed syntax. Replace our custom rule for timer arguments with a
pair of `no-restricted-syntax` option objects.
@Trott Trott added the tools Issues and PRs related to the tools directory. label Apr 2, 2017
Copy link
Contributor

@not-an-aardvark not-an-aardvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The no-unescaped-regexp-dot custom rule does feature detection here for the sourceCode.getIndexFromLoc and sourceCode.getLocFromIndex methods, which were added to the ESLint rule API in 3.17.0. Since we've now upgraded to ESLint 3.19.0, that feature detection is probably no longer necessary.

@mscdex
Copy link
Contributor

mscdex commented Apr 2, 2017

@not-an-aardvark Unless the eslint update gets backported to all branches, it might be best to keep it for awhile for better compatibility since the other branches seem to use different versions of eslint compared to master.

@not-an-aardvark
Copy link
Contributor

not-an-aardvark commented Apr 2, 2017

@mscdex Seems reasonable.


If we're interested, almost all of the other custom rules can also be replaced with selectors in no-restricted-syntax:

  • prefer-common-mustnotcall can be replaced with a selector: CallExpression[callee.object.name="common"][callee.property.name="mustNotCall"] > Literal[value=0]
  • prefer-assert-methods can be replaced with a selector: ExpressionStatement > CallExpression[callee.name="assert"][arguments.0.operator="==="] (with a few variations for !==, ==, !=)
  • no-let-in-for-declaration can be replaced with a selector: ForStatement > VariableDeclaration[kind="let"], ForInStatement > VariableDeclaration[kind="let"], ForOfStatement > VariableDeclaration[kind="let"]
  • new-with-error can be replaced with a selector: ThrowStatement > CallExpression[callee.name=/Error$/]
  • buffer-constructor can be replaced with a selector: CallExpression[callee.name="Buffer"], NewExpression[callee.name="Buffer"]
  • assert-throws-arguments can be replaced with a selector: CallExpression[callee.object.name="assert"][callee.property.name="throws"][arguments.1.type="Literal"]:not([arguments.1.regex])
  • assert-fail-single-argument can be replaced with a selector: CallExpression[callee.object.name="assert"][callee.property.name="fail"][arguments.length=1]
  • require-buffer can be replaced with a no-restricted-globals configuration

From what I can tell, having these custom rules hasn't been a big maintenance burden, so there's not really any need to switch, but I thought I'd bring up the possibility.

@gibfahn
Copy link
Member

gibfahn commented Apr 2, 2017

From what I can tell, having these custom rules hasn't been a big maintenance burden, so there's not really any need to switch, but I thought I'd bring up the possibility.

@not-an-aardvark if we can configure built-in rules rather than creating our own, that seems like a better way to do things. Could you raise a PR so we can see the details of how it would actually work in practice?

@jasnell
Copy link
Member

jasnell commented Apr 4, 2017

jasnell pushed a commit that referenced this pull request Apr 4, 2017
PR-URL: #12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 4, 2017
ESLint 3.19.0 allows the specification of selectors that represent
disallowed syntax. Replace our custom rule for timer arguments with a
pair of `no-restricted-syntax` option objects.

PR-URL: #12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@jasnell
Copy link
Member

jasnell commented Apr 4, 2017

Landed in 3166652...f637703

@jasnell jasnell closed this Apr 4, 2017
@jasnell jasnell mentioned this pull request Apr 4, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Apr 10, 2017
PR-URL: nodejs#12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@italoacasas
Copy link
Contributor

cc @Trott

Trott added a commit to Trott/io.js that referenced this pull request Apr 11, 2017
ESLint 3.19.0 allows the specification of selectors that represent
disallowed syntax. Replace our custom rule for timer arguments with a
pair of `no-restricted-syntax` option objects.

PR-URL: nodejs#12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@Trott
Copy link
Member Author

Trott commented Apr 11, 2017

@italoacasas #12329

@MylesBorins
Copy link
Contributor

rich same for v6

@Trott Trott mentioned this pull request Apr 19, 2017
@Trott
Copy link
Member Author

Trott commented Apr 19, 2017

@MylesBorins #12504

Trott added a commit to Trott/io.js that referenced this pull request Apr 23, 2017
ESLint 3.19.0 allows the specification of selectors that represent
disallowed syntax. Replace our custom rule for timer arguments with a
pair of `no-restricted-syntax` option objects.

PR-URL: nodejs#12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Trott added a commit to Trott/io.js that referenced this pull request Apr 25, 2017
PR-URL: nodejs#12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 26, 2017
Backport-PR-URL: #12504
PR-URL: #12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@evanlucas evanlucas mentioned this pull request May 1, 2017
evanlucas pushed a commit that referenced this pull request May 1, 2017
ESLint 3.19.0 allows the specification of selectors that represent
disallowed syntax. Replace our custom rule for timer arguments with a
pair of `no-restricted-syntax` option objects.

PR-URL: #12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 2, 2017
Backport-PR-URL: #12504
PR-URL: #12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@MylesBorins MylesBorins mentioned this pull request May 23, 2017
@Trott
Copy link
Member Author

Trott commented Jul 18, 2017

Removing backport-requested-v6.x because #12504 landed.

@Trott
Copy link
Member Author

Trott commented Jul 18, 2017

...and added backported-to-v6.x label.

andrew749 pushed a commit to michielbaird/node that referenced this pull request Jul 19, 2017
Backport-PR-URL: nodejs/node#12504
PR-URL: nodejs/node#12162
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@Trott Trott deleted the eslint-3.19.0 branch January 13, 2022 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.